home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 422_02 / dosutil / comchk.doc < prev    next >
Text File  |  1994-03-20  |  1KB  |  35 lines

  1. This utility patches ".COM" programs so that they will automatically
  2. perform a checksum of themselves when they load.
  3.  
  4. Use: COMCHK <oldfile> <newfile>
  5.  
  6. EG:  COMCHK TEST.COM TEST1.COM
  7.  
  8. The above line will create a TEST1.COM which behaves exactly the same as
  9. TEST.COM, except that it checksums itself befor running the original
  10. program, and aborts with a 'Corrupt image' message if it thinks it has
  11. been altered.
  12.  
  13. At present, the program only works with ".COM" files < 64K in size.
  14. Source is provided... Feel free to enhance it as you see fit.
  15.  
  16. The program was written in and can be compiled with MICRO-C version
  17. 2.1 (or greater). It should be fairly easy to port to other compilers
  18. or earlier versions of MICRO-C, by modifying the low-level I/O function
  19. calls: "open, close, read, write, lrewind".
  20.  
  21. To compile with MICRO-C, use:
  22.  
  23.             cc comchk -flop         /* Produce CAN.OBJ */
  24.             masm/ml ecan;           /* Produce ECAN.OBJ */
  25.             lc comchk ecomchk       /* Link to produce CAN.COM */
  26.  
  27. This program MUST be compiled in the TINY model (.COM file)... It
  28. references some of its CODE as DATA in order to copy the embedded
  29. function into the patched output file, and therefore must have
  30. overlaid code and data segments.
  31.  
  32. Enjoy,
  33.  
  34. Dave Dunfield
  35.